#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"

Ok_name=''
Fail_name=''
Judge=0
TTimeout=2

function trigger_plugin() {
	dt=`date +%s`
	datev=`date +%Y%m%d%H%M`
	dirname='/var/log/onecert_mondir'
	if [ ! -d $dirname ]; then
	    mkdir -p $dirname
	fi
	condorpsfilename=$dirname"/condorpromon_"$datev
        script="/cvmfs/common.ihep.ac.cn/software/monitor_plugin/program_ps_plugin/plugin.py"
        if [ -f $script ];then
        	/afs/ihep.ac.cn/soft/common/Python64/bin/python3.2 $script $condorpsfilename
		if [ $? -eq 0 ]
		then
			Ok_name="condorpro monitoring program is running"
		else
			Judge=1
			Fail_name="condorpro monitoring program is stoped"
		fi
        else
		Judge=1
		Fail_name="condorpro monitoring program is not exist"
        fi
        
find $dirname -cmin +10080 -name "condorpromon_*"  -exec /bin/rm -rf {} \;
}


trigger_plugin $1

